$OpenBSD: patch-Modules_FindTclStub_cmake,v 1.5 2014/09/11 10:24:38 dcoppa Exp $
--- Modules/FindTclStub.cmake.orig	Thu Jul 31 17:03:56 2014
+++ Modules/FindTclStub.cmake	Wed Sep  3 08:10:09 2014
@@ -58,13 +58,21 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindTCL.cmake)
 
 get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
 get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
-string(REGEX REPLACE
-  "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
+if(MODTCL_VERSION)
+  set(TCL_TCLSH_VERSION "${MODTCL_VERSION}")
+else(MODTCL_VERSION)
+  string(REGEX REPLACE
+    "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
+endif(MODTCL_VERSION)
 
 get_filename_component(TK_WISH_PATH "${TK_WISH}" PATH)
 get_filename_component(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH)
-string(REGEX REPLACE
-  "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}")
+if(MODTK_VERSION)
+  set(TK_WISH_VERSION "${MODTK_VERSION}")
+else(MODTK_VERSION)
+  string(REGEX REPLACE
+    "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}")
+endif(MODTK_VERSION)
 
 get_filename_component(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH)
 get_filename_component(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH)
@@ -79,14 +87,20 @@ get_filename_component(TK_LIBRARY_PATH_PARENT "${TK_LI
 string(REGEX REPLACE
   "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}")
 
-set(TCLTK_POSSIBLE_LIB_PATHS
-  "${TCL_INCLUDE_PATH_PARENT}/lib"
-  "${TK_INCLUDE_PATH_PARENT}/lib"
-  "${TCL_LIBRARY_PATH}"
-  "${TK_LIBRARY_PATH}"
-  "${TCL_TCLSH_PATH_PARENT}/lib"
-  "${TK_WISH_PATH_PARENT}/lib"
-)
+if(NOT "${TCLTK_OPENBSD_LIB_PATHS}" STREQUAL "")
+  set(TCLTK_POSSIBLE_LIB_PATHS
+    "${TCLTK_OPENBSD_LIB_PATHS}"
+    )
+else()
+  set(TCLTK_POSSIBLE_LIB_PATHS
+    "${TCL_INCLUDE_PATH_PARENT}/lib"
+    "${TK_INCLUDE_PATH_PARENT}/lib"
+    "${TCL_LIBRARY_PATH}"
+    "${TK_LIBRARY_PATH}"
+    "${TCL_TCLSH_PATH_PARENT}/lib"
+    "${TK_WISH_PATH_PARENT}/lib"
+  )
+endif()
 
 if(WIN32)
   get_filename_component(
